package toolkit;

import android.content.Context;
import android.content.res.Resources;
import android.util.DisplayMetrics;

public class SystemInfo {
	private static DisplayMetrics dm = Resources.getSystem().getDisplayMetrics();
	 
	public static DisplayMetrics getDisplayMetrics(Context c) {
		dm = c.getApplicationContext().getResources().getDisplayMetrics();
		return dm;
	}

	public String toString() {
		return dm.toString();
	}

	/**
	 * Converts DIP to pixels.
	 * 
	 * @param dip
	 *            the value of the dip.
	 * @return the value of the pixels.
	 */
	public static int dipToPixel(int dip) {
		return (int) (dip * dm.density + 0.5f);
	}

}
